<!--
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
-->

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="">
<head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>添加角色</title>

    <meta name="pragma" content="no-cache">
    <meta name="cache-control" content="no-cache">
    <meta name="content-type" content="text/html;charset=UTF-8">
    <meta name="expires" content="0">
    <!--	<%@ include file="../../script.html" %>-->
    <link th:insert="~{views/script :: tiancai}"/>


</head>

<body style="width:100%;max-width:600px;padding:30px 60px;">
<section class="info-section">
    <form id="form" method="post">
        <table>
            <tr>
                <td class="text-title">产品名称：</td>
                <td class="text-content">
                    <input type="hidden" name="id" th:value="${productPojo.id }">
                    <input type="text" name="name" th:value="${productPojo.name }"
                           class="easyui-textbox theme-textbox-radius"
                           data-options="required:true,validType:'length[3,10]'">
                </td>
            </tr>
            <tr>
                <td class="text-title">详情链接：</td>
                <td class="text-content">
                    <input type="text" name="link" th:value="${productPojo.link }"
                           class="easyui-textbox theme-textbox-radius" data-options="required:true">
<!--                    <input type="hidden" name="productVO.user" value="${productVO.user }">-->
                </td>
            </tr>

             <tr>
                <td class="text-title">创建人：</td>
                 <td class="text-content">
                     <select  class="myselect" data-options="required:true,validType:'length[2,10]'" th:name="creatorUserId" style="height: 35px;size: 16px;font-weight: bold" >
                         <option th:each="l:${userPojoList}" th:value="${l.id}" th:selected="${l.id == productPojo.creatorUserId}">[[${l.userName}]]</option>
                     </select>
                 </td>

            </tr>

<!--            <tr>-->

<!--                <td class="text-content">-->
<!--                    <input type="hidden" name="updateTime" value="${productPojo.updateTime }">-->
<!--                    <input type="hidden" name=createTime" value="${productPojo.createTime }">-->
<!--                </td>-->
<!--            </tr>-->
            <!-- <tr>
                <td class="text-title">更新时间：</td>
                <td class="text-content">
                    <input type="text" name="productVO.updatetime" value="${productVO.updatetime }" class="easyui-textbox theme-textbox-radius"data-options="required:true">
                </td>
            </tr>
             -->
            <tr>
                <td class="text-title">成本价格：</td>
                <td class="text-content">
                    <input type="text" name="costPrice" th:value="${productPojo.costPrice }"
                           class="easyui-textbox theme-textbox-radius" data-options="required:true">
                </td>
            </tr>

            <tr>
                <td class="text-title">产品类别:</td>
                <td class="text-content">
                    <select  class="myselect" data-options="required:true,validType:'length[2,10]'" name="categoryId" style="height: 35px;size: 16px;font-weight: bold">
                        <option th:each="cpl:${categoryPojoList}" th:value="${cpl.id}" th:selected="${cpl.id == productPojo.getCategoryId()}">[[${cpl.name}]]</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="text-title">建议价格：</td>
                <td class="text-content">
                    <input type="text" name="suggestedPrice" th:value="${productPojo.suggestedPrice }"
                           class="easyui-textbox theme-textbox-radius" data-options="required:true">
                </td>
            </tr>

            <tr>
                <td colspan="2" style="text-align: center;margin-top: 10px;">
                    <a href="javascript:void(0);" id="saveBtn" class="easyui-linkbutton button-primary">保存</a>
                    <a href="javascript:void(0);" id="resetBtn" class="easyui-linkbutton button-danger">重置</a>
                </td>
            </tr>
        </table>
    </form>
</section>
<script type="text/javascript" th:inline="none">
    $(function () {
        //重置按钮
        $("#resetBtn").on("click", function (event) {
            $("#form").form("reset");
        });

        //为保存按钮添加事件
        $("#saveBtn").on("click", function (event) {
            $("#form").form("submit", {
                url: "/updateProduct",
                onSumbit: function () {
                    //调用easyui中form对象的validate方法对表单中数据进行校验，该方法返回boolean值，如果为false会阻止表单提交
                    return $("#form").form("validate");
                },
                success: function (data) {
                    var obj = eval("(" + data + ")");
                    if (obj.success) {
                        $.messager.alert("提示", obj.message);
                        parent.closeTopWindow();
                    } else {
                        $.messager.alert("警告", obj.message);
                    }
                }
            });
        });

    });

</script>
</body>
</html>
				
